
const Error = {
  UNKOWN: function() {
    return {
      errCode: "10001",
      errMsg: "未知异常"
    }
  }(),
  SUCCESS: function(){
    return {
      errCode: "0",
      errMsg: "操作成功"
    }
  }(),
  LESSPRIMARYKEY: function(){
    return {
      errCode: "20001",
      errMsg: "缺少必要主键参数"
    }
  }(),
  FILETYPEERROR: function(){
    return {
      errCode: "30001",
      errMsg: "文件类型不正确"
    }
  }(),
  /**
   * @description 获取错误信息，默认为成功
   * @author xiezuobing[948466]<435321508@qq.com>
   * @param {any} errCode 
   * @param {any} errMsg 
   * @returns  
   */
  getErrorMsg(errCode,errMsg) {
    return {
      errCode: errCode || Error.SUCCESS.errCode,
      errMsg: errMsg || Erroo.SUCCESS.errMsg
    }
  }
}

module.exports = Error;